package com.uw.uwconfig.server.cluster;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ClusterMonitor {

    private final Election election;

    private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

    public ClusterMonitor(Election election) {
        this.election = election;
    }

    public void start() {
        executor.scheduleWithFixedDelay(election::lock, 1000, 5000, TimeUnit.MILLISECONDS);
    }


    public void stop() {
        executor.shutdown();
    }


}
